package com.rtssoft.scalatest

object SortTest {

    def sortq(data: Array[Int], direct: Int = +1) : Array[Int] = {
        if(data.size <= 1)
            data
        else {
            val p = data(data.size / 2)
            if(direct > 0)
                Array.concat(sortq(data.filter(p>),direct), data.filter(p==), sortq(data.filter(p<),direct))
            else
                Array.concat(sortq(data.filter(p<),direct), data.filter(p==), sortq(data.filter(p>),direct))
        }
    }
}
